<html>
	<head>
		<meta charset="utf-8" />
        <style type=text/css>
        body{
            background-image:url(bj.jpg);
		background-repeat:no-repeat;
        }
        .father{
            width:350px;
            height:250px;
            border:1px solid #ffc0cb;
            box-sizing: border-box;
            line-height:50px;
            padding-top:5px;
        }
        div{
            margin-top:15%;
        }
        .dl{
            margin-right:20px;
        }
        .yhzc{
            margin-left:20px;
            text-decoration:none;
        }

        </style>
	</head>
	<body>
		<center>
        <div class="father">
        <h2>学生信息管理系统</h2>
        <form method="post" action="">
        用户名：<input type="text" name="username"><br>
        密&nbsp;&nbsp;&nbsp;码：<input type="password" name="pwd"><br>
        <input type="submit" value="登录" class="dl">
        <input type="reset" value="取消" >
        <a href='zcym.php' class="yhzc"> 用户注册 <a>
        </div>
        </center>
	</body>
</html>
<?php
session_start();
require 'conn.php';
if(isset($_POST['username']) && isset($_POST['pwd'])) 
{
  $username=$_POST['username'];
  $pwd=$_POST['pwd'];
  $result=mysqli_query($link,"select * from user where name='$username' and pwd='$pwd'" );
  $num=mysqli_num_rows($result);
  if($num){

      $_SESSION['name']=$username;
    echo "<script>alert('登录成功！');window.location.href='index2.php';</script>";
  }
  else{echo "<script>alert('登录失败！用户名错误或者密码错误，请重新登录。');</script>";} 
}

?>